<template>
  <div class="rent-page">
     <van-nav-bar
  title="房屋管理"
  left-arrow
  @click-left="onClickLeft"
/>
<div class="empty-container" v-if='list.length===0'>
  <img src="http://liufusong.top:8080/img/not-found.png">
  <p>您还没有房源，<a class="Rent">去发布房源</a>吧~</p>
</div>

<!-- 如果发布了房源 -->
<van-list
  v-model="loading"
  :finished="finished"
  finished-text="没有更多了"
  @load="onLoad"

>

<Item v-for='(item,index) in list' :key='index' :item='item'></Item>
</van-list>

  </div>
</template>

<script>
import Item from '@/components/ListI.vue'
import { RentuserFn } from '@/api/user'
export default {
  name: 'rent-page',
  data () {
    return {
      list: [],
      loading: false,
      finished: false

    }
  },
  components: {
    Item
  },
  methods: {
    onClickLeft () {
      this.$router.back()
    },
    async onLoad () {
      const { body } = await RentuserFn()
      console.log(body)
      this.list = body
      this.finished = true
    }
  }

}
</script>

<style>
.empty-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.empty-container img {
    width: 150px;
    margin: 30px

}
.Rent{
    color: #33be85;
}

</style>
